Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocr3config/return active candidate #285

Merged
merged 11 commits into from
Nov 4, 2024

Conversation

0xAustinWang
Copy link
Collaborator

@0xAustinWang 0xAustinWang commented Oct 31, 2024

https://smartcontract-it.atlassian.net/browse/CCIP-2687

Updates the home_chain_reader to return an 'ActiveAndCandidate' instance, rather than an array.
This is necessary for us to distinguish "HOW" to operate on changes when managing state transitions.
Previously we returned an array of two configurations, with the assumption that there would always be one active. This is not the case with keystone, where new configurations are initialized as candidates.

commit/report.go Outdated Show resolved Hide resolved
execute/plugin.go Outdated Show resolved Hide resolved
internal/reader/home_chain.go Outdated Show resolved Hide resolved
@0xAustinWang 0xAustinWang requested a review from makramkd November 4, 2024 09:25
@@ -721,7 +721,7 @@ func setupNode(params SetupNodeParams, nodeID commontypes.OracleID) nodeSetup {
homeChainReader.EXPECT().GetFChain().Return(fChain, nil)
homeChainReader.EXPECT().
GetOCRConfigs(mock.Anything, params.donID, consts.PluginTypeCommit).
Return([]reader.OCR3ConfigWithMeta{{}}, nil).Maybe()
Return(reader.ActiveAndCandidate{}, nil).Maybe()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename to reader.ActiveAndCandidateConfig

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline, will rename this in the future.

commit/report.go Outdated Show resolved Hide resolved
commit/report.go Show resolved Hide resolved
execute/plugin.go Outdated Show resolved Hide resolved
execute/plugin.go Outdated Show resolved Hide resolved
var (
ocrConfigs []OCR3ConfigWithMeta
allConfigs ActiveAndCandidate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename allConfigs to ActiveAndCandidate. Maybe instead of ActiveCandidateConfig rename the struct to:

type ConfigPair struct {
   ActiveConfig Config
   CandidateConfig Config
}

So then when we see a variable named configPair it's cleaner

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline, will rename this in the future.

@0xAustinWang 0xAustinWang requested a review from dimkouv November 4, 2024 11:00
ref: develop
ref: ccip/launcherRefactor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to revert this before merging

@0xAustinWang 0xAustinWang force-pushed the ocr3config/returnActiveCandidate branch from d1062e5 to 743f0d8 Compare November 4, 2024 12:50
@@ -9,6 +9,8 @@ import (
"testing"
"time"

ocrTypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We've been calling this ocr3types elsewhere, nice to stay consistent

Suggested change
ocrTypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
ocr3types "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a collision in the file :(

We already have an import as "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof interesting

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just ocrtypes then

@@ -14,6 +15,7 @@ import (

"github.com/smartcontractkit/libocr/commontypes"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
ocr2t "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ocr2t "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
ocr3types "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, there's a collision in the file because we import github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types

Copy link

github-actions bot commented Nov 4, 2024

Metric ocr3config/returnActiveCandidate main
Coverage 72.9% 72.8%

@0xAustinWang 0xAustinWang merged commit 4b7e196 into main Nov 4, 2024
3 of 4 checks passed
@mateusz-sekara mateusz-sekara deleted the ocr3config/returnActiveCandidate branch November 8, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants